package bb.lanxing.lib.devices.ble.ble.services;

//import com.alipay.sdk.packet.d;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleSensorDevice;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleService;
import bb.lanxing.lib.devices.ble.ble.characteristic.SensorLocationCharacteristics;
import bb.lanxing.lib.devices.ble.ble.characteristic.cadence.CscFeatureCharacteristics;
import bb.lanxing.lib.devices.ble.ble.characteristic.cadence.CscMeasurementCharacteristics;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: CSCBleService.kt */

public final class CSCBleService extends BaseBleService {
    private CscFeatureCharacteristics cscFeatureCharacteristics;
    private CscMeasurementCharacteristics cscMeasurementCharacteristics;
    private SensorLocationCharacteristics sensorLocationCharacteristics;

    public CSCBleService(BaseBleSensorDevice device) {
        super(device);
        Intrinsics.checkNotNullParameter(device, "device");
    }

    public CscFeatureCharacteristics getCscFeatureCharacteristics() {
        return this.cscFeatureCharacteristics;
    }

    public void setCscFeatureCharacteristics(CscFeatureCharacteristics cscFeatureCharacteristics) {
        this.cscFeatureCharacteristics = cscFeatureCharacteristics;
    }

    public CscMeasurementCharacteristics getCscMeasurementCharacteristics() {
        return this.cscMeasurementCharacteristics;
    }

    public void setCscMeasurementCharacteristics(CscMeasurementCharacteristics cscMeasurementCharacteristics) {
        this.cscMeasurementCharacteristics = cscMeasurementCharacteristics;
    }

    public SensorLocationCharacteristics getSensorLocationCharacteristics() {
        return this.sensorLocationCharacteristics;
    }

    public void setSensorLocationCharacteristics(SensorLocationCharacteristics sensorLocationCharacteristics) {
        this.sensorLocationCharacteristics = sensorLocationCharacteristics;
    }

    @Override
    public UUID targetUUID() {
        UUID fromString = UUID.fromString("00001816-0000-1000-8000-00805f9b34fb");
        Intrinsics.checkNotNullExpressionValue(fromString, "fromString(BLEAttributes.BLE_CADENCE_SERVICE)");
        return fromString;
    }

    public final class CSCBleService$initialization$1 extends ContinuationImpl {
        Object L$0;
        int label;
        Object result;
        final CSCBleService this$0;

        public CSCBleService$initialization$1(CSCBleService cSCBleService, Continuation<? super CSCBleService$initialization$1> continuation) {
            super((Continuation<Object>) continuation);
            this.this$0 = cSCBleService;
        }

        @Override
        public Object invokeSuspend(Object obj) {
            this.result = obj;
            this.label |= Integer.MIN_VALUE;
            return this.this$0.initialization(this);
        }
    }
    @Override
    public Object initialization(Continuation<? super Unit> continuation) {
        CSCBleService$initialization$1 cSCBleService$initialization$1;
        Object coroutine_suspended;
        int i;
        CSCBleService cSCBleService = null;
        CSCBleService cSCBleService2;
        if (continuation instanceof CSCBleService$initialization$1) {
            cSCBleService$initialization$1 = (CSCBleService$initialization$1) continuation;
            if ((cSCBleService$initialization$1.label & Integer.MIN_VALUE) != 0) {
                cSCBleService$initialization$1.label -= Integer.MIN_VALUE;
                Object obj = cSCBleService$initialization$1.result;
                coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
                i = cSCBleService$initialization$1.label;
                if (i != 0) {
                    ResultKt.throwOnFailure(obj);
                    CscFeatureCharacteristics cscFeatureCharacteristics = new CscFeatureCharacteristics(this);
                    cscFeatureCharacteristics.read();
                    this.cscFeatureCharacteristics = cscFeatureCharacteristics;
                    cSCBleService$initialization$1.L$0 = this;
                    cSCBleService$initialization$1.label = 1;
                    if (delayInPeer(cSCBleService$initialization$1) == coroutine_suspended) {
                        return coroutine_suspended;
                    }
                    cSCBleService = this;
                } else if (i != 1) {
                    if (i == 2) {
                        cSCBleService2 = (CSCBleService) cSCBleService$initialization$1.L$0;
                        ResultKt.throwOnFailure(obj);
                        SensorLocationCharacteristics sensorLocationCharacteristics = new SensorLocationCharacteristics(cSCBleService2);
                        sensorLocationCharacteristics.read();
                        cSCBleService2.sensorLocationCharacteristics = sensorLocationCharacteristics;
                        return Unit.INSTANCE;
                    }
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                } else {
                    cSCBleService = (CSCBleService) cSCBleService$initialization$1.L$0;
                    ResultKt.throwOnFailure(obj);
                }
                CscMeasurementCharacteristics cscMeasurementCharacteristics = new CscMeasurementCharacteristics(cSCBleService);
                cscMeasurementCharacteristics.enableNotify();
                cSCBleService.cscMeasurementCharacteristics = cscMeasurementCharacteristics;
                cSCBleService$initialization$1.L$0 = cSCBleService;
                cSCBleService$initialization$1.label = 2;
                if (cSCBleService.delayInPeer(cSCBleService$initialization$1) != coroutine_suspended) {
                    return coroutine_suspended;
                }
                cSCBleService2 = cSCBleService;
                SensorLocationCharacteristics sensorLocationCharacteristics2 = new SensorLocationCharacteristics(cSCBleService2);
                sensorLocationCharacteristics2.read();
                cSCBleService2.sensorLocationCharacteristics = sensorLocationCharacteristics2;
                return Unit.INSTANCE;
            }
        }
        cSCBleService$initialization$1 = new CSCBleService$initialization$1(this, (Continuation<? super CSCBleService$initialization$1>) continuation);
        Object obj2 = cSCBleService$initialization$1.result;
        coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
        i = cSCBleService$initialization$1.label;
        if (i != 0) {
        }
        CscMeasurementCharacteristics cscMeasurementCharacteristics2 = new CscMeasurementCharacteristics(cSCBleService);
        cscMeasurementCharacteristics2.enableNotify();
        cSCBleService.cscMeasurementCharacteristics = cscMeasurementCharacteristics2;
        cSCBleService$initialization$1.L$0 = cSCBleService;
        cSCBleService$initialization$1.label = 2;
        if (cSCBleService.delayInPeer(cSCBleService$initialization$1) != coroutine_suspended) {
        }
        return coroutine_suspended;
    }
}
